#DES new decisions#

DES_desert_gambit_category = {

	DES_finish_aswan_dam_mission = {
		icon = GFX_decision_factories
		allowed = { always = no }
		available = {
			has_global_flag = aswan_high_dam_finished
		}
		selectable_mission = yes
		is_good = no
		days_mission_timeout = 545
		ai_will_do = {
			base = 100
		}
		complete_effect = { ###LETS GO
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_finish_aswan_dam_mission"
			add_ideas = { INT_EGY_trade_agreement_INT_side }
			diplomatic_relation = {
				country = EGY
				relation = docking_rights
			}
			ENG = {
				diplomatic_relation = {
					country = EGY
					relation = docking_rights
				}
				add_ideas = { INT_EGY_trade_agreement_INT_side }
			}
			EGY = { add_ideas = { INT_EGY_trade_agreement_EGY_side } }
			news_event = DESnews.2
		}
		timeout_effect = { ###Bad End
			log = "[GetDateText]: [Root.GetName]: Decision timeout DES_ashgabat_accord_mission"
			add_political_power = -25
		}
	}

	DES_pick_egypt = {
		icon = GFX_decision_generic_agreement
		allowed = { tag = FRA }
		available = {
			has_global_flag = aswan_high_dam_finished
		}
		cost = 5

		fire_only_once = yes
		ai_will_do = {
			base = 100
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_pick_egypt target: [From.GetName]"
			activate_targeted_decision = { target = EGY decision = DES_FRA_generic_mission }
			activate_targeted_decision = { target = EGY decision = DES_EGY_join_phalanstere }
			activate_targeted_decision = { target = 447 decision = DES_alexandria_port } 
			activate_targeted_decision = { target = 446 decision = DES_cairo_industrial_park } 
			activate_targeted_decision = { target = 552 decision = DES_western_desert_oil }
		}
	}

	DES_FRA_generic_mission = {
		icon = GFX_decision_generic_army_support
		allowed = { always = no }
		available = {
			land_doctrine_level > 0
		}
		custom_cost_trigger = {
			command_power > 25
		}
		custom_cost_text = CP_25
		fire_only_once = yes
		ai_will_do = {
			base = 10
			modifier = {
				add = 20
				command_power > 75
			}
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_GER_generic_mission target: [From.GetName]"
			hidden_effect = {
				add_command_power = -25
			}
			FROM = {
				country_event = DES.3
			}
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				army_experience = 30
				FROM = {
					add_ideas = FRA_DES_generic_military_mission
					add_popularity = { ideology = syndicalist popularity = 0.04 }
					activate_targeted_decision = { target = FRA decision = DES_EGY_new_marine_division }
				}
			}
		}
	}

	DES_EGY_join_phalanstere = {
		icon = GFX_decision_generic_flags
		allowed = { always = no }
		available = {
			has_completed_focus = FRA_found_the_phalanstere_international
			EGY = { has_completed_focus = EGY_Victory_Levant }
		}
		cost = 50
		fire_only_once = yes
		ai_will_do = {
			base = 25
			modifier = {
				add = 5
				has_political_power > 100
			}
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_EGY_join_phalanstere target: [From.GetName]"
			diplomatic_relation = {
				country = EGY
				relation = non_aggression_pact
			}
			diplomatic_relation = {
				country = EGY
				relation = military_access
			}
			ENG = {
				diplomatic_relation = {
					country = EGY
					relation = non_aggression_pact
				}
				diplomatic_relation = {
					country = EGY
					relation = military_access
				}
				diplomatic_relation = {
					country = EGY
					relation = docking_rights
				}
			}
			FROM = {
				FRA_add_to_phalanstere = yes
			}
		}
	}

	DES_EGY_new_marine_division = {
		icon = GFX_decision_soldierly_discipline
		allowed = { always = no } #activated by effect
		available = {
			EGY = { has_idea = FRA_DES_generic_military_mission }
			has_capitulated = no
			has_tech = tech_support
		}

		days_remove = 60
		modifier = {
			political_power_gain = -0.5
			command_power_gain = -0.25
		}
		custom_cost_trigger = {
			has_equipment = { infantry_equipment > 999 }
			has_manpower > 12000
		}
		custom_cost_text = 12000_mp_1000_eq

		fire_only_once = yes

		ai_will_do = { factor = 100 }

		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_EGY_new_marine_division"
			hidden_effect = {
				add_manpower = -12000
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = -1000
				}
			}
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_EGY_new_marine_division"

			division_template = {
				name = "New Marine Division"

				regiments = {
					marine = { x = 0 y = 0 }
					marine = { x = 0 y = 1 }
					marine = { x = 0 y = 2 }
					marine = { x = 1 y = 0 }
					marine = { x = 1 y = 1 }
					marine = { x = 1 y = 2 }
					marine = { x = 2 y = 0 }
					marine = { x = 2 y = 1 }
					marine = { x = 2 y = 2 }
					marine = { x = 3 y = 0 }
					marine = { x = 3 y = 1 }
					marine = { x = 3 y = 2 }
					artillery_brigade = { x = 4 y = 0 }
					artillery_brigade = { x = 4 y = 1 }
				}
				support = {
					rangers_support = { x = 0 y = 0 }
					pioneer_support = { x = 0 y = 1 }
					artillery = { x = 0 y = 2 }
				}
			}
			hidden_effect = {
				random_owned_controlled_state = {
					limit = { valid_state_for_spawning_friendly_unit = yes }
					create_unit = {
						division = "name = \"1. New Marine Division\" division_template = \"New Marine Division\" start_experience_factor = 1"
						owner = ROOT
					}
				}
			}
			custom_effect_tooltip = DES_EGY_new_marine_division_tt
		}
	}

	DES_aswan_high_dam = {
		icon = GFX_decision_hol_drain_water_lines
		allowed = { always = no }
		visible = {
			456 = { is_fully_controlled_by = EGY }
			1008 = { is_fully_controlled_by = EGY }
			446 = { is_fully_controlled_by = EGY }
			447 = { is_fully_controlled_by = EGY }
		}
		cancel_if_not_visible = yes
		available = {
			FROM = { is_fully_controlled_by = EGY }
			num_of_civilian_factories_available_for_projects > 3
		}
		highlight_states = {
			highlight_state_targets = {
				state = 456 #Aswan
				state = 1008
				state = 446
				state = 447
			}
		}
		cost = 10

		state_target = yes
		days_remove = 365
		fire_only_once = yes
		modifier = { civilian_factory_use = 4 }
		ai_will_do = {
			base = 1000
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_aswan_high_dam target: [From.GetName]"
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_aswan_high_dam target: [From.GetName]"
			set_global_flag = aswan_high_dam_finished
			EGY = {
				add_timed_idea = {
    					idea = DES_red_influence
    					days = 720
				}
			}
			456 = {
				add_extra_state_shared_building_slots = 6
				add_building_construction = { type = infrastructure level = 1 }
				add_building_construction = { type = industrial_complex level = 4 }
				increase_state_category_by_two_levels = yes
			}
			1008 = {
				add_building_construction = { type = infrastructure level = 1 }
				increase_state_category_by_two_levels = yes
			}
			446 = {
				add_building_construction = { type = infrastructure level = 1 }
				increase_state_category_by_two_levels = yes
			}
			447 = {
				add_building_construction = { type = infrastructure level = 1 }
				increase_state_category_by_two_levels = yes
			}
		}
	}

	DES_alexandria_port = {
		icon = GFX_decision_generic_naval_base
		allowed = { always = no }
		visible = {
			FROM = { is_fully_controlled_by = EGY }
		}
		cancel_if_not_visible = yes
		available = {
			FROM = { is_fully_controlled_by = EGY }
			num_of_civilian_factories_available_for_projects > 2
		}
		highlight_states = { highlight_state_targets = { state = 447 } } #Alexandria
		cost = 25

		state_target = yes
		days_remove = 90
		fire_only_once = yes
		modifier = { civilian_factory_use = 3 }
		ai_will_do = {
			base = 0
			modifier = {
				add = 5
				has_political_power > 100
			}
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_alexandria_port target: [From.GetName]"
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_alexandria_port target: [From.GetName]"
			447 = {
				add_extra_state_shared_building_slots = 2
				add_building_construction = { type = infrastructure level = 1 }
				add_building_construction = {
					type = naval_base
					level = 3
					province = 4076
					instant_build = yes
				}
				add_building_construction = {
					type = coastal_bunker
					level = 5
					province = 4076
					instant_build = yes
				}
				add_building_construction = { type = industrial_complex level = 1 }
				add_building_construction = { type = dockyard level = 1 }
				increase_state_category_by_one_level = yes
			}
		}
	}

	DES_cairo_industrial_park = {
		icon = GFX_decision_generic_industry
		allowed = { always = no }
		visible = {
			FROM = { is_fully_controlled_by = EGY }
		}
		cancel_if_not_visible = yes
		available = {
			FROM = { is_fully_controlled_by = EGY }
			num_of_civilian_factories_available_for_projects > 2
		}
		highlight_states = { highlight_state_targets = { state = 446 } } #Cairo
		cost = 50

		state_target = yes
		days_remove = 90
		fire_only_once = yes
		modifier = { civilian_factory_use = 3 }
		ai_will_do = {
			base = 0
			modifier = {
				add = 5
				has_political_power > 100
			}
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_cairo_industrial_park target: [From.GetName]"
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_cairo_industrial_park target: [From.GetName]"
			EGY = { add_popularity = { ideology = syndicalist popularity = 0.04 } }
			446 = {
				add_extra_state_shared_building_slots = 4
				add_building_construction = { type = infrastructure level = 1 }
				add_building_construction = { type = industrial_complex level = 2 }
				add_building_construction = { type = arms_factory level = 2 }
				add_resource = {
					type = steel
					amount = 12
				}
				increase_state_category_by_one_level = yes
			}
		}
	}

	DES_western_desert_oil = {
		icon = GFX_decision_oil
		allowed = { always = no }
		visible = {
			FROM = { is_fully_controlled_by = EGY }
		}
		cancel_if_not_visible = yes
		available = {
			FROM = { is_fully_controlled_by = EGY }
			num_of_civilian_factories_available_for_projects > 2
		}
		highlight_states = {
			highlight_state_targets = {
				state = 452
				state = 552 #western desert
			}
		}
		cost = 30

		state_target = yes
		days_remove = 90
		fire_only_once = yes
		modifier = { civilian_factory_use = 3 }
		ai_will_do = {
			base = 0
			modifier = {
				add = 5
				has_political_power > 100
			}
		}
		complete_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision complete DES_western_desert_oil target: [From.GetName]"
		}
		remove_effect = {
			log = "[GetDateText]: [Root.GetName]: Decision remove DES_western_desert_oil target: [From.GetName]"
			452 = {
				add_building_construction = { type = infrastructure level = 1 }
				add_resource = {
					type = oil
					amount = 12
				}
			}
			give_resource_rights = { receiver = FRA state = 452 }
			552 = {
				add_building_construction = { type = infrastructure level = 1 }
				add_resource = {
					type = oil
					amount = 6
				}
			}
		}
	}

}